package com.atguigui.leetcode;

/**
 * 1470.重新排列数组
 * Project: leetcode
 * Package: com.atguigui.leetcode
 * Version: 1.0
 * <p>
 * Created by WJX on 2022/8/29 13:00
 */
public class P1470ShuffleTheArray {

    public static void main(String[] args) {
        Solution solution = new P1470ShuffleTheArray().new Solution();
        // TO TEST
    }

    class Solution {
        public int[] shuffle(int[] nums, int n) {
            int length = nums.length / 2;

            int[] ans = new int[nums.length];

            for (int i = 0; i < length; i++) {
                ans[i * 2] = nums[i];
                ans[i * 2 + 1] = nums[i + length];
            }

            return ans;

        }
    }
}
